package com.li.springbootproject.spring.initializer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * 自定义容器初始化组件
 *
 * @author LiDong
 * @version 1.0.0
 * @createTime 3/12/2022 9:50 AM
 */
public class CustomInitializer implements ApplicationContextInitializer {

    private static final Logger logger = LoggerFactory.getLogger(CustomInitializer.class);

    @Override
    public void initialize(ConfigurableApplicationContext applicationContext) {
        logger.info("====================CustomInitializer start======================");
        logger.info("CustomInitializer initialize方法被执行...");
        logger.info("ApplicationName: {}", applicationContext.getApplicationName());
        logger.info("isActive: {}", applicationContext.isActive());
        logger.info("====================CustomInitializer end======================");
    }
}
